import 'package:flutter/material.dart';
import 'package:sz/tools/color.dart';

class SWSCheckBox extends StatelessWidget {
  const SWSCheckBox({
    Key? key,
    this.value,
    this.onChanged,
  }) : super(key: key);
  final bool? value;
  final ValueChanged<bool?>? onChanged;

  @override
  Widget build(BuildContext context) {
    return Checkbox(
      value: value,
      onChanged: onChanged,
      fillColor: MaterialStateProperty.resolveWith((states) {
        if (states.contains(MaterialState.selected)) {
          return SzColor.primary;
        } else {
          return const Color(0xffffffff);
        }
      }),
      side: const BorderSide(
        color: Color(0xffcdcdcd),
        width: 1,
        style: BorderStyle.solid,
      ),
      shape: const CircleBorder(), //圆角
      materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, // 把范围缩小到最小
    ); //
  }
}
